//
//  YYBuyCarVC.m
//  drivingSchool
//
//  Created by 子yu 刘 on 2018/8/19.
//  Copyright © 2018年 子yu 刘. All rights reserved.
//

#import "YYBuyCarVC.h"
#import "YYNewCarVC.h"
#import "YYusedcarVC.h"
#import "SDCycleScrollView.h"
#import "YYSpellGroupDetailVC.h"


@interface YYBuyCarVC ()<SDCycleScrollViewDelegate>
@property (strong, nonatomic) SDCycleScrollView *adCycleScrollView;
@property (nonatomic,strong) NSDictionary * groupDict;

@end

@implementation YYBuyCarVC

- (void)viewDidLoad {
    [super viewDidLoad];
//    [self setUpUI];
//    [self getData];
//    [self getGroup];
}

//- (void)setUpUI{
//    SDCycleScrollView *adCycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:self.bannerView.bounds delegate:self placeholderImage:[UIImage new]];
//    adCycleScrollView.zoomType = NO;  // 是否使用缩放效果
//    adCycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
//    adCycleScrollView.scrollDirection = UICollectionViewScrollDirectionHorizontal;
//    adCycleScrollView.currentPageDotColor = [UIColor colorWithHexString:@"08c5ed"];
//    adCycleScrollView.pageDotColor = [UIColor colorWithHexString:@"bdbdbd"];
//    adCycleScrollView.pageControlDotSize = CGSizeMake(4, 4);  // pageControl小点的大小
//    adCycleScrollView.contentMode = UIViewContentModeScaleAspectFill;
//    [self.bannerView addSubview:adCycleScrollView];
//    [adCycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.right.mas_equalTo(0);
//        make.top.mas_equalTo(0);
//        make.bottom.mas_equalTo(0);
//    }];
//    self.adCycleScrollView = adCycleScrollView;
//}
//
//- (void)getData{
//    [RequestOperationManager paycarBanner_success:^(id result) {
//        if (DEF_REQ_SUCCESS) {
//            NSArray  * dataArr = result[@"data"];
//            NSMutableArray * imageArr = [NSMutableArray arrayWithCapacity:0];
//            for (NSDictionary * image in dataArr) {
//                [imageArr addObject:[NSString stringWithFormat:@"%@%@",DEF_INTERFACE_WEBVIEWSERVICE,image[@"image"]]];
//            }
//             self.adCycleScrollView.imageURLStringsGroup =imageArr;
//        }
//        
//    } failture:^(NSError *error) {
//        
//    }];
//    
//}
//
//- (void)getGroup{
//    [RequestOperationManager paycarGroup_success:^(id result) {
//        if (DEF_REQ_SUCCESS) {
//              self.groupDict = [[result[@"data"]firstObject] copy];
//            if (self.groupDict.count>0) {
//                self.groupHeight.constant = 140;
//                self.groupView.hidden = NO;
//                self.lbCar.text = self.groupDict[@"brand"];
//                [self.carImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",DEF_INTERFACE_WEBVIEWSERVICE,self.groupDict[@"vehicle_img"]]]];
//            }else{
//                self.groupView.hidden = YES;
//                self.groupHeight.constant = 0;
//            }
//
//        }
//        
//    } failture:^(NSError *error) {
//        
//    }];
//}



- (IBAction)toGroup:(id)sender {
//    YYSpellGroupDetailVC * detail = (YYSpellGroupDetailVC *)[CFUtility getVC:@"YYSpellGroupDetailVC" Storyboard:BUYCAR];
//    
//    detail.carId = self.groupDict;
//    [self.navigationController pushViewController:detail animated:YES];
    
}

- (instancetype)init {
    if (self = [super init]) {
        self.menuViewStyle = WMMenuViewStyleLine;
        self.titleColorNormal = DEF_COLOR_TEXT;
        self.titleColorSelected = DEF_COLOR_TEXT1;
        self.progressColor = DEF_COLOR_MAIN;
        self.progressHeight = 1;
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
//        self.menuViewStyle = WMMenuViewStyleSegmented;
//        self.titleColorNormal = DEF_COLOR_TEXT;
//        self.titleColorSelected = DEF_COLOR_TEXT1;
//        self.progressColor = DEF_COLOR_MAIN;
//        //self.progressHeight = 1;
//        self.showOnNavigationBar = YES;
      
        self.menuItemWidth = 60;
        self.menuViewStyle = WMMenuViewStyleSegmented;
        self.menuViewLayoutMode = WMMenuViewLayoutModeCenter;
        self.titleColorNormal = [UIColor whiteColor];
        self.titleColorSelected = DEF_COLOR_MAIN;
        self.titleSizeNormal = 13;
        self.titleSizeSelected = 13;
//        self.menuViewContentMargin = 20;
//        self.cachePolicy = 0;
        self.progressViewCornerRadius = 1;
        self.menuView.progressView.cornerRadius = 1;
        self.showOnNavigationBar = YES;
        self.progressColor = [UIColor whiteColor];
    }
    return self;
}

- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController{
    return 2;
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index{
    if (index == 0) {
        return @"新车";
    }else{
        return @"二手车";
    }
}

-(UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index{
    YYNewCarVC * newCar = (YYNewCarVC *)[CFUtility getVC:@"YYNewCarVC" Storyboard:BUYCAR];
    YYusedcarVC * usedCar = (YYusedcarVC *)[CFUtility getVC:@"YYusedcarVC" Storyboard:BUYCAR];
    if (index == 0) {
        return newCar;
    }else{
        return usedCar;
    }
    
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForContentView:(WMScrollView *)contentView {
  return CGRectMake(0, 0, DEF_SCREEN_WIDTH(), DEF_SCREEN_HEIGHT()-DEF_NAV_HEIGHT()-DEF_TABBAR_HEIGHT());

}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForMenuView:(WMMenuView *)menuView{
     menuView.backgroundColor = [UIColor clearColor];
    return CGRectMake(0, 0,120, 26);
}





@end
